<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button class='btn'>抽奖</button>
  <script>
    var arr = ["钢铁侠","蜘蛛侠","美国队长","鹰眼","雷神","绿巨人"];
    var oBtn = document.querySelector(".btn");
    // 取的是0~5之间的随机数
    oBtn.onclick = function(){
      var num = Math.floor(Math.random()*arr.length);
      alert(arr[num]);
    }
    // 拓展案例：抽出的人不能重复出现
  </script>
</body>
</html>